import path from "path"
import resret from "../../commonPort/resret"
import {
    readFlie,
    writeFlie
} from "../../../../fs_file包封装/node_modules/fs_file"
export default function amend(req, res) { //修改
    var arr = JSON.parse(readFlie(path.join(__dirname, "../json/json.json")))
    let {
        is,
        name,
        cs,
        num,
        day
    } = JSON.parse(req.buf)
    let str = is
    let brr = str.split("-")
    let [i, j] = brr
    i *= 1
    j *= 1
    let b = arr[i]["list"][j]
    b["name"] = name
    b["class"] = cs
    b["num"] = num
    b["day"] = day
    arr[i]["list"][j] = b
    writeFlie(path.join(__dirname, "../json/json.json"), JSON.stringify(arr))
    resret({
        res,
        text: "001"
    })
    return true;

}